import DelButton from '../../components/delbutton';
import { IData, Result as R1 } from '../api/teamglz/query.api';
import Edit from './edit';
import { Message as M3, Result as R3 } from '../api/teamglz/del.api';
import api from '../../atoms/api';
import Table from '../../components/table';

export default function List({ data, teams, classs }: {
	data: IData[];
	teams: Pick<ITbteam, 'team_id' | 'teamname' | 'teammate'>[];
	classs: Pick<ITbclass, 'class_id' | 'classname' | 'grade'>[];
	id: string;
}) {
	return <>
		<Table
			idfieldname='team_id'
			data={data}
			render={(record) => {
				const { teamname, classname, ...data } = record;
				const team_id = record.team_id;
				const url = `/teamglz/project?id=${team_id}`;
				return <>
					<a href={url}>项目管理</a>
					<a>查看详情</a>
					<Edit teams={teams} classs={classs} />
					<DelButton query={{
						team_id
					}} dlgtitle='确认删除' api={api['/api/teamglz/del']} />
				</>;
			}}
		>
			<Table.Column<IData> title='年级' key='grade' dataIndex='grade' align='left' />
			<Table.Column<IData> title='班级名称' key='classname' dataIndex='classname' align='left' />
			<Table.Column<IData> title='团队名称' key='teamname' dataIndex='teamname' align='left' />
		</Table>
	</>;
}
